<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>控制台</title>
    <script src="scripts/boot.js" type="text/javascript"></script>
    <link href="res/third-party/scrollbar/jquery.mCustomScrollbar.css" rel="stylesheet" type="text/css" />
    <script src="res/third-party/scrollbar/jquery.mCustomScrollbar.concat.min.js" type="text/javascript"></script>
    <link href="res/menu/menu.css" rel="stylesheet" type="text/css" />
    <script src="res/menu/menu.js" type="text/javascript"></script>
    <script src="res/menutip.js" type="text/javascript"></script>
    <link href="res/tabs.css" rel="stylesheet" type="text/css" />
    <link href="res/frame.css" rel="stylesheet" type="text/css" />
    <link href="res/index.css" rel="stylesheet" type="text/css" />
    <link href="res/fonts/font-icons.min.css" rel="stylesheet" type="text/css" />
    <script src="js/vue.min.js" type="text/javascript"></script>
    <style>
        li.icontop a{
            height: 50px;
            line-height: 50px;
            font-size: 16px;
        }
        li.icontop .thover{
            background:rgba(0,0,0,0.1) !important;
        }
        #win1 .mini-panel-body{background: lightyellow;}
    </style>
</head>
<body>

<div id="app" class="navbar">
    <div class="navbar-header">
        <img src="img/logo_light.png" height="50"/>
    </div>
    <!--
    <ul class="nav navbar-nav">
        <li><a id="toggle"><span class="fa fa-bars" ></span></a></li>
        <li class="icontop"><a class="thover" href="#">民事案件</a></li>
        <li class="icontop"><a href="#">刑事案件</a></li>
        <li class="icontop"><a href="#">执行案件</a></li>
        <li class="icontop"><a href="#">数据大屏</a></li>
    </ul>
    -->
    <ul class="nav navbar-nav navbar-right">
        <li><a href="javascript:void(0)">${admin.truename}</a></li>
        <li><a href="javascript:editPassword()"><i class="fa fa-pencil-square-o"></i> 修改密码</a></li>
        <li ><a href="javascript:logout()" onclick="logout()"><i class="fa fa-user"></i> 退出登录</a></li>
    </ul>
</div>

<div class="container">

    <div class="sidebar" style="padding:0 8px;">
        <div id="mainMenu"></div>
    </div>

    <div class="main">
        <div id="mainTabs" class="mini-tabs main-tabs" activeIndex="0" style="height:100%;" plain="false"
             buttons="#tabsButtons" arrowPosition="side" >
            <div name="index" id="0" iconCls="fa fa-fw icon-home" title="首页"></div>
        </div>
    </div>

</div>

<div id="win1" class="mini-window" title="提示" style="width:400px;height:250px;"
     showMaxButton="false" showCollapseButton="false" showShadow="true"
     showToolbar="false" showFooter="false" showModal="false" allowResize="false" allowDrag="false"
>

</div>


</body>
</html>
<script>
    let basepath = window.location.pathname + "/../";
    let alertTot = 0;
    let overdueTot = 0;

    function activeTab(item) {
        var tabs = mini.get("mainTabs");
        var tab = tabs.getTab(item.id);
        if (!tab) {
            tab = { name: item.id, title: item.text, url: item.url, iconCls: item.iconCls, showCloseButton: true };
            tab = tabs.addTab(tab);
        }
        tabs.activeTab(tab);
    }
    function openEventItem(){
        const item = {
            name: '21',
            text: '所有事件',
            url: 'eventItem/list',
            iconCls: 'fa fa-fw icon-location-pin',
            showCloseButton: true
        };
        activeTab(item);
    }
    $(function(){
        mini.parse();
        //menu
        var menu = new Menu("#mainMenu", {
            itemclick: function (item) {
                if (!item.children) {
                    activeTab(item);
                }
            }
        });

        $(".sidebar").mCustomScrollbar({ autoHideScrollbar: true });

        new MenuTip(menu);

        $.ajax({
            url: "admin/getMenu",
            type : "post",
            data : {},
            cache : false,
            success: function (text) {
                var data = mini.decode(text);
                menu.loadData(data);
            }
        });

        //toggle
        $("#toggle, .sidebar-toggle").click(function () {
            $('body').toggleClass('compact');
            mini.layout();
        });

        //dropdown
        $(".dropdown-toggle").click(function (event) {
            $(this).parent().addClass("open");
            return false;
        });

        $(document).click(function (event) {
            $(".dropdown").removeClass("open");
        });
    });

    function showEventWindow(content){
        var win = mini.get("win1");
        win.showAtPos('right', 'bottom');
        win.setBody(content);
        setTimeout(function () {
            if(win){
                //win.hide();
            }
        },5000);
    }

    function editPassword(){
        mini.open({
            url : basepath+"edit_password",
            title : "修改密码",
            width : 400,
            height : 320,
            allowResize: false,
            onload : function() {

            },
            ondestroy : function(action) {
                if (action == "save") {
                    grid.reload();
                }
            }
        });
    }

    function logout() {
        mini.confirm("确认要退出吗？", "退出登录",
            function (action) {
                if (action == "ok") {
                    window.top.location.href = 'logout';
                }
            }
        );
    }

</script>
